package chatGUI;

import java.util.ArrayList;

import javax.swing.JList;
import javax.swing.JTabbedPane;

import people.User;

/**
 * <b>Project ChatSystemG2 - INSA 4INFOA1 - 2013/2014</b>
 * <P>
 * <i>Package  chatGUI</i> <br>
 * ToUser is an interface. <br>
 * It represents the messages from the chat system to the client. <br>
 *
 * @author Sergio Gonzalez - Marie-Charlotte Bideaud
 */

public interface ToUser {

	/**
	 * When a new user gets connected : updates the userslist
	 * 
	 * @param usernames : Object[]
	 * @param list : JList 
	 */
	public void newUserAlarm (Object[] usernames, JList list) ;
	
	/**
	 * Displays the windowconnect (and closes the the chat window if it is opened)   
	 */
	public void loginRequest () ;
	
	/**
	 * Displays the windowcomunica 
	 */
	public void listOptionRequest () ;
	
	/**
	 * When the local user receives a new text message, it is written in the corresponding tab 
	 * 
	 * @param valid : boolean
	 * 
	 * @return boolean
	 */
	public boolean newMessageReceived (boolean valid) ;
	
	/**
	 * When the remote user refuses the file request sent by the local user 
	 * @param user : User
	 * @param tabList : ArrayList<ChatTab>
	 * @return boolean
	 */
	public boolean fileRefused (User user, ArrayList<ChatTab> tabList) ;
	
	/**
	 * When the remote user accepts the file request sent by the local user
	 * @param user : User
	 * @param tabList : ArrayList<ChatTab>
	 * @return boolean
	 */
	public boolean fileAccepted (User user, ArrayList<ChatTab> tabList) ;
	
	/**
	 * When the local user receives a file  
	 */
	public void newFileReceived () ;
	
	/**
	 * When a user gets disconnected, remove it from the userslist and remove the corresponding tab
	 * 
	 * @param user : User
	 * @param tabList : ArrayList<ChatTab>
	 * @param tabbedPane : JTabbedPane
	 */
	public void deleteUserAlarm (User user, ArrayList<ChatTab> tabList, JTabbedPane tabbedPane) ;
	
	/**
	 * When the local user receives a file request, and answers it
	 * 
	 * @param user : User
	 */
	public void newFileRequest (User user) ;
	
}
